package Classes.GameUtils
{
	/** 
	 * @author thy
	 * @version 1.0.0 
	 * 创建时间：Jun 7, 2012 2:32:57 PM 
	 *  新鲜事数据类
	 */ 
	public class GU_NewThingsInfo
	{
		private static var _instance:GU_NewThingsInfo; /*静态引用*/
		
		public function GU_NewThingsInfo(){}
		
		public static function get instance():GU_NewThingsInfo
		{
			if (!_instance)
				_instance=new GU_NewThingsInfo();
			return _instance;
		} 
		private var newThingsObj:Object=new Object();
		
		/**
		 * 初始化新鲜事 
		 * @param newThingsXMLList
		 */		
		public function initNewThings(newThingsXMLList:XMLList):void
		{
			for each (var xml:XML in newThingsXMLList.item)
			{
				var tmpobj:Object=new Object();
				tmpobj.type=xml.@type;
				tmpobj.title=xml.@title;
				tmpobj.context=xml.@context;
				tmpobj.img=xml.@img;
				tmpobj.imgName=xml.@imgName;
				tmpobj.saytxt=xml.@saytxt;
				
				newThingsObj[xml.@type]=tmpobj;
			}
		}
		
		/**
		 * 根据新鲜事的type返回具体的新鲜事 的内容
		 * @param type
		 * @return 
		 * 
		 */		
		public function getNewThingsByType(type:int):Object
		{
			return this.newThingsObj[type];
		}
	}
}
